package edu.upf.Ilusio.Entities;

/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
 * Schema.
 * $Id$
 */

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Enumeration;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;

/**
 * Class Area.
 * 
 * @version $Revision$ $Date$
 */
public class Area implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _x1
     */
    private int _x1;

    /**
     * keeps track of state for field: _x1
     */
    private boolean _has_x1;

    /**
     * Field _y1
     */
    private int _y1;

    /**
     * keeps track of state for field: _y1
     */
    private boolean _has_y1;

    /**
     * Field _x2
     */
    private int _x2;

    /**
     * keeps track of state for field: _x2
     */
    private boolean _has_x2;

    /**
     * Field _y2
     */
    private int _y2;

    /**
     * keeps track of state for field: _y2
     */
    private boolean _has_y2;

    /**
     * Field _tagList
     */
    private java.util.ArrayList _tagList;

    /**
     * Field _keywordList
     */
    private java.util.ArrayList _keywordList;

    /**
     * Field _description
     */
    private java.lang.String _description;


      //----------------/
     //- Constructors -/
    //----------------/

    public Area() 
     {
        super();
        _tagList = new ArrayList();
        _keywordList = new ArrayList();
    } //-- Area()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addKeyword
     * 
     * 
     * 
     * @param vKeyword
     */
    public void addKeyword(java.lang.String vKeyword)
        throws java.lang.IndexOutOfBoundsException
    {
        _keywordList.add(vKeyword);
    } //-- void addKeyword(java.lang.String) 

    /**
     * Method addKeyword
     * 
     * 
     * 
     * @param index
     * @param vKeyword
     */
    public void addKeyword(int index, java.lang.String vKeyword)
        throws java.lang.IndexOutOfBoundsException
    {
        _keywordList.add(index, vKeyword);
    } //-- void addKeyword(int, java.lang.String) 

    /**
     * Method addTag
     * 
     * 
     * 
     * @param vTag
     */
    public void addTag(java.lang.String vTag)
        throws java.lang.IndexOutOfBoundsException
    {
        _tagList.add(vTag);
    } //-- void addTag(java.lang.String) 

    /**
     * Method addTag
     * 
     * 
     * 
     * @param index
     * @param vTag
     */
    public void addTag(int index, java.lang.String vTag)
        throws java.lang.IndexOutOfBoundsException
    {
        _tagList.add(index, vTag);
    } //-- void addTag(int, java.lang.String) 

    /**
     * Method clearKeyword
     * 
     */
    public void clearKeyword()
    {
        _keywordList.clear();
    } //-- void clearKeyword() 

    /**
     * Method clearTag
     * 
     */
    public void clearTag()
    {
        _tagList.clear();
    } //-- void clearTag() 

    /**
     * Method deleteX1
     * 
     */
    public void deleteX1()
    {
        this._has_x1= false;
    } //-- void deleteX1() 

    /**
     * Method deleteX2
     * 
     */
    public void deleteX2()
    {
        this._has_x2= false;
    } //-- void deleteX2() 

    /**
     * Method deleteY1
     * 
     */
    public void deleteY1()
    {
        this._has_y1= false;
    } //-- void deleteY1() 

    /**
     * Method deleteY2
     * 
     */
    public void deleteY2()
    {
        this._has_y2= false;
    } //-- void deleteY2() 

    /**
     * Method enumerateKeyword
     * 
     * 
     * 
     * @return Enumeration
     */
    public java.util.Enumeration enumerateKeyword()
    {
        return new org.exolab.castor.util.IteratorEnumeration(_keywordList.iterator());
    } //-- java.util.Enumeration enumerateKeyword() 

    /**
     * Method enumerateTag
     * 
     * 
     * 
     * @return Enumeration
     */
    public java.util.Enumeration enumerateTag()
    {
        return new org.exolab.castor.util.IteratorEnumeration(_tagList.iterator());
    } //-- java.util.Enumeration enumerateTag() 

    /**
     * Returns the value of field 'description'.
     * 
     * @return String
     * @return the value of field 'description'.
     */
    public java.lang.String getDescription()
    {
        return this._description;
    } //-- java.lang.String getDescription() 

    /**
     * Method getKeyword
     * 
     * 
     * 
     * @param index
     * @return String
     */
    public java.lang.String getKeyword(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _keywordList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (String)_keywordList.get(index);
    } //-- java.lang.String getKeyword(int) 

    /**
     * Method getKeyword
     * 
     * 
     * 
     * @return String
     */
    public java.lang.String[] getKeyword()
    {
        int size = _keywordList.size();
        java.lang.String[] mArray = new java.lang.String[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (String)_keywordList.get(index);
        }
        return mArray;
    } //-- java.lang.String[] getKeyword() 

    /**
     * Method getKeywordCount
     * 
     * 
     * 
     * @return int
     */
    public int getKeywordCount()
    {
        return _keywordList.size();
    } //-- int getKeywordCount() 

    /**
     * Method getTag
     * 
     * 
     * 
     * @param index
     * @return String
     */
    public java.lang.String getTag(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _tagList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (String)_tagList.get(index);
    } //-- java.lang.String getTag(int) 

    /**
     * Method getTag
     * 
     * 
     * 
     * @return String
     */
    public java.lang.String[] getTag()
    {
        int size = _tagList.size();
        java.lang.String[] mArray = new java.lang.String[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (String)_tagList.get(index);
        }
        return mArray;
    } //-- java.lang.String[] getTag() 

    /**
     * Method getTagCount
     * 
     * 
     * 
     * @return int
     */
    public int getTagCount()
    {
        return _tagList.size();
    } //-- int getTagCount() 

    /**
     * Returns the value of field 'x1'.
     * 
     * @return int
     * @return the value of field 'x1'.
     */
    public int getX1()
    {
        return this._x1;
    } //-- int getX1() 

    /**
     * Returns the value of field 'x2'.
     * 
     * @return int
     * @return the value of field 'x2'.
     */
    public int getX2()
    {
        return this._x2;
    } //-- int getX2() 

    /**
     * Returns the value of field 'y1'.
     * 
     * @return int
     * @return the value of field 'y1'.
     */
    public int getY1()
    {
        return this._y1;
    } //-- int getY1() 

    /**
     * Returns the value of field 'y2'.
     * 
     * @return int
     * @return the value of field 'y2'.
     */
    public int getY2()
    {
        return this._y2;
    } //-- int getY2() 

    /**
     * Method hasX1
     * 
     * 
     * 
     * @return boolean
     */
    public boolean hasX1()
    {
        return this._has_x1;
    } //-- boolean hasX1() 

    /**
     * Method hasX2
     * 
     * 
     * 
     * @return boolean
     */
    public boolean hasX2()
    {
        return this._has_x2;
    } //-- boolean hasX2() 

    /**
     * Method hasY1
     * 
     * 
     * 
     * @return boolean
     */
    public boolean hasY1()
    {
        return this._has_y1;
    } //-- boolean hasY1() 

    /**
     * Method hasY2
     * 
     * 
     * 
     * @return boolean
     */
    public boolean hasY2()
    {
        return this._has_y2;
    } //-- boolean hasY2() 

    /**
     * Method isValid
     * 
     * 
     * 
     * @return boolean
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method marshal
     * 
     * 
     * 
     * @param out
     */
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * Method marshal
     * 
     * 
     * 
     * @param handler
     */
    public void marshal(org.xml.sax.ContentHandler handler)
        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     * Method removeKeyword
     * 
     * 
     * 
     * @param vKeyword
     * @return boolean
     */
    public boolean removeKeyword(java.lang.String vKeyword)
    {
        boolean removed = _keywordList.remove(vKeyword);
        return removed;
    } //-- boolean removeKeyword(java.lang.String) 

    /**
     * Method removeTag
     * 
     * 
     * 
     * @param vTag
     * @return boolean
     */
    public boolean removeTag(java.lang.String vTag)
    {
        boolean removed = _tagList.remove(vTag);
        return removed;
    } //-- boolean removeTag(java.lang.String) 

    /**
     * Sets the value of field 'description'.
     * 
     * @param description the value of field 'description'.
     */
    public void setDescription(java.lang.String description)
    {
        this._description = description;
    } //-- void setDescription(java.lang.String) 

    /**
     * Method setKeyword
     * 
     * 
     * 
     * @param index
     * @param vKeyword
     */
    public void setKeyword(int index, java.lang.String vKeyword)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _keywordList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _keywordList.set(index, vKeyword);
    } //-- void setKeyword(int, java.lang.String) 

    /**
     * Method setKeyword
     * 
     * 
     * 
     * @param keywordArray
     */
    public void setKeyword(java.lang.String[] keywordArray)
    {
        //-- copy array
        _keywordList.clear();
        for (int i = 0; i < keywordArray.length; i++) {
            _keywordList.add(keywordArray[i]);
        }
    } //-- void setKeyword(java.lang.String) 

    /**
     * Method setTag
     * 
     * 
     * 
     * @param index
     * @param vTag
     */
    public void setTag(int index, java.lang.String vTag)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _tagList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _tagList.set(index, vTag);
    } //-- void setTag(int, java.lang.String) 

    /**
     * Method setTag
     * 
     * 
     * 
     * @param tagArray
     */
    public void setTag(java.lang.String[] tagArray)
    {
        //-- copy array
        _tagList.clear();
        for (int i = 0; i < tagArray.length; i++) {
            _tagList.add(tagArray[i]);
        }
    } //-- void setTag(java.lang.String) 

    /**
     * Sets the value of field 'x1'.
     * 
     * @param x1 the value of field 'x1'.
     */
    public void setX1(int x1)
    {
        this._x1 = x1;
        this._has_x1 = true;
    } //-- void setX1(int) 

    /**
     * Sets the value of field 'x2'.
     * 
     * @param x2 the value of field 'x2'.
     */
    public void setX2(int x2)
    {
        this._x2 = x2;
        this._has_x2 = true;
    } //-- void setX2(int) 

    /**
     * Sets the value of field 'y1'.
     * 
     * @param y1 the value of field 'y1'.
     */
    public void setY1(int y1)
    {
        this._y1 = y1;
        this._has_y1 = true;
    } //-- void setY1(int) 

    /**
     * Sets the value of field 'y2'.
     * 
     * @param y2 the value of field 'y2'.
     */
    public void setY2(int y2)
    {
        this._y2 = y2;
        this._has_y2 = true;
    } //-- void setY2(int) 

    /**
     * Method unmarshal
     * 
     * 
     * 
     * @param reader
     * @return Object
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (Area) Unmarshaller.unmarshal(Area.class, reader);
    } //-- java.lang.Object unmarshal(java.io.Reader) 

    /**
     * Method validate
     * 
     */
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
